﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CamelCaseWordSplitter.UnitTests
{
    [TestClass]
    public class CamelCaseWordSplitterTests
    {
        [TestMethod]
        public void TestUpperCamelForJohnDoe()
        {
            CollectionAssert.AreEqual(new string[] { "John", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("JohnDoe"));
        }

        [TestMethod]
        public void TestLowerCamelForJohnDoe()
        {
            CollectionAssert.AreEqual(new string[] { "john", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("johnDoe"));
        }

        [TestMethod]
        public void TestUpperCamelForJohn()
        {
            CollectionAssert.AreEqual(new string[] { "John" }, CamelCaseWordSplitter.ParseIntoWords("John"));
        }

        [TestMethod]
        public void TestLowerCamelForJohn()
        {
            CollectionAssert.AreEqual(new string[] { "john" }, CamelCaseWordSplitter.ParseIntoWords("john"));
        }

        [TestMethod]
        public void TestUpperCamelJohnJDoe()
        {
            CollectionAssert.AreEqual(new string[] { "John", "J", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("JohnJDoe"));
        }

        [TestMethod]
        public void TestLowerCamelJohnJDoe()
        {
            CollectionAssert.AreEqual(new string[] { "john", "J", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("johnJDoe"));
        }

        [TestMethod]
        public void TestUpperCamelJohnJ()
        {
            CollectionAssert.AreEqual(new string[] { "John", "J" }, CamelCaseWordSplitter.ParseIntoWords("JohnJ"));
        }

        [TestMethod]
        public void TestLowerCamelJohnJ()
        {
            CollectionAssert.AreEqual(new string[] { "john", "J" }, CamelCaseWordSplitter.ParseIntoWords("johnJ"));
        }

        [TestMethod]
        public void TestUpperCamelJohnJD()
        {
            CollectionAssert.AreEqual(new string[] { "John", "JD" }, CamelCaseWordSplitter.ParseIntoWords("JohnJD"));
        }

        [TestMethod]
        public void TestLowerCamelJohnJD()
        {
            CollectionAssert.AreEqual(new string[] { "john", "JD" }, CamelCaseWordSplitter.ParseIntoWords("johnJD"));
        }

        [TestMethod]
        public void TestUpperCamelJohnJoeDoe()
        {
            CollectionAssert.AreEqual(new string[] { "John", "Joe", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("JohnJoeDoe"));
        }

        [TestMethod]
        public void TestLowerCamelJohnJoeDoe()
        {
            CollectionAssert.AreEqual(new string[] { "john", "Joe", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("johnJoeDoe"));
        }

        [TestMethod]
        public void TestUpperCamelJJDoe()
        {
            CollectionAssert.AreEqual(new string[] { "JJ", "Doe" }, CamelCaseWordSplitter.ParseIntoWords("JJDoe"));
        }

        [TestMethod]
        public void TestSingleUpperCaseLetter()
        {
            CollectionAssert.AreEqual(new string[] { "A" }, CamelCaseWordSplitter.ParseIntoWords("A"));
        }

        [TestMethod]
        public void TestTwoUpperCaseLetters()
        {
            CollectionAssert.AreEqual(new string[] { "AA" }, CamelCaseWordSplitter.ParseIntoWords("AA"));
        }

        [TestMethod]
        public void TestThreeUpperCaseLetters()
        {
            CollectionAssert.AreEqual(new string[] { "AAA" }, CamelCaseWordSplitter.ParseIntoWords("AAA"));
        }

        [TestMethod]
        public void TestSingleLowerCaseLetter()
        {
            CollectionAssert.AreEqual(new string[] { "a" }, CamelCaseWordSplitter.ParseIntoWords("a"));
        }

        [TestMethod]
        public void TestTwoLowerCaseLetters()
        {
            CollectionAssert.AreEqual(new string[] { "aa" }, CamelCaseWordSplitter.ParseIntoWords("aa"));
        }

        [TestMethod, ExpectedException(typeof(ArgumentNullException))]
        public void TestNullInput()
        {
            CamelCaseWordSplitter.ParseIntoWords(null);
        }

        [TestMethod, ExpectedException(typeof(ArgumentException))]
        public void TestDigitInInput()
        {
            CamelCaseWordSplitter.ParseIntoWords("Test1");
        }

        [TestMethod, ExpectedException(typeof(ArgumentException))]
        public void TestSpaceInput()
        {
            CamelCaseWordSplitter.ParseIntoWords(" Test");
        }
    }
}
